<%@include file="startUpIncludes.jsp" %>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>
            View Appointment
        </title>
    </head>
    <body>
    <jsp:include page="header.jsp" >
		<jsp:param value="true" name="loggedIn"/>
	</jsp:include>
    <div class="wrap">
	<div class="fitBG">
        <div class="main">
		<%@include file="basicLeftMenu.jsp" %>
            <div class="content">
				<jsp:include page="tabs.jsp" >
					<jsp:param value="leads" name="currentPage"/>
				</jsp:include>
                <div class="tab-content">
                <h3>View Appointment</h3>
                <span class="numberError error-block">Please enter a valid number.</span>
                <form class="new-lead-form" method="post" action="/sales/s/edit-appointment" id="editAppointmentForm">
                <div class="btns">
                <a  href="/sales/s/leads" class="form-btn">Back</a>
                </div>
                <div class="form-row">
                <input type="hidden" name="id" value="${id}"/>
                <input type="hidden" name="parentId" value="${parentId}"/>
                <input type="hidden" name="parentType" value="${parentType}"/>
                    <h4>Appointment Information</h4>
                    <div class="info"><label>Appointment Owner: </label><span>${userDetails.fName} ${userDetails.lName}</span></div>
                    <div class="info"><label>Lead Name: </label><span>${lead.fName}</span></div>
                    <div class="info"><label>Lead Company: </label><span>${lead.companyName}</span></div>
                    <div class="input-col">
                    
                        <label>Sales Man: </label>
	                    <span>${appointment.salesMan.fName} {salesMan.lName}</span>
                        <label>Contacted Person: </label>
	                    <span>${appointment.contactedPerson.fName}</span>
                        <label>Comment: </label>
                        <span>${appointment.comment}</span>
                    </div>
                    <div class="input-col">
                        <label>Day: </label>
                        <span>${appointment.day}</span>
                        <label>Date: </label>
                        <c:set var="date" value="${appointment.date}"/>
						<c:set var="datesubstring" value="${fn:substring(date, 0, 10)}" />
                        <c:set var="datesplit" value="${fn:split(datesubstring, '-')}" />
                        <c:set var="day" value="${datesplit[2]}" />
						<c:set var="month" value="${datesplit[1]}" />
						<c:set var="year" value="${datesplit[0]}" />
                        <span>${day}/${month}/${year}</span>
                        <label>Starting Time: </label>
                        <span>${appointment.time}</span>
                        <label>Ending Time: </label>
                        <span>${appointment.meetingDuration}</span>
                    </div>
                </div>
                <div class="form-row">
                    <h4>Meeting Information</h4>
                    <div class="input-col">
                        <label>Confirmation date expected: </label>
                        <span>
                        <c:choose>                        
                        <c:when test="${appointment.confirmationDateExpected == true}">Yes</c:when>
                        <c:when test="${appointment.confirmationDateExpected == false}">No</c:when>
                        <c:otherwise>      </c:otherwise>
                        </c:choose>
                        </span>
                        <label>Meeting done: </label>
                        <span>
                        <c:choose>
                         <c:when test="${appointment.meetingDone == true}">Yes</c:when>
                        <c:when test="${appointment.meetingDone == false}">No</c:when>
                        <c:otherwise>      </c:otherwise>                        
                        </c:choose>
                        </span>
                        <label>Customer need: </label>
                        <span>${appointment.customerNeed}</span>
                        <label>Demo done: </label>
                        <span>
                        <c:choose>
                        <c:when test="${appointment.demoDone == true}">Yes</c:when>
                        <c:when test="${appointment.demoDone == false}">No</c:when>
                        <c:otherwise>      </c:otherwise> 
                        </c:choose>
                        </span>
                        <label>Offer submitted: </label>
                        <span>
                        <c:choose>
                        <c:when test="${appointment.offerSubmitted == true}">Yes</c:when>
                        <c:when test="${appointment.offerSubmitted == false}">No</c:when>
                        <c:otherwise>      </c:otherwise> 
                        </c:choose>
                        </span>
                    </div>
                    <div class="input-col">
                        <label>Discount done: </label>
                        <span>
                        <c:choose>
                        <c:when test="${appointment.discountDone == true}">Yes</c:when>
                        <c:when test="${appointment.discountDone == false}">No</c:when>
                        <c:otherwise>      </c:otherwise> 
                        </c:choose>
                        </span>
                        <label>Competitor offer: </label>
                        <span>
                        <c:choose>
                        <c:when test="${appointment.compatitorOffer == true}">Yes</c:when>
                        <c:when test="${appointment.compatitorOffer == false}">No</c:when>
                        <c:otherwise>      </c:otherwise>
                        </c:choose>
                        </span>
                        <label>Reply period: </label>
                        <span>${appointment.replyPeriod}</span>
                        <label>Deal closing done: </label>
                        <span>
                        <c:choose>
                        <c:when test="${appointment.dealClosingDone == true}">Yes</c:when>
                        <c:when test="${appointment.dealClosingDone == false}">No</c:when>
                        <c:otherwise>      </c:otherwise>
                        </c:choose>
                        </span>
                        <label>Deal closing reason: </label>
                        <span>${appointment.dealClosingReason}</span>
                    </div>
                </div>
                <div class="form-row">
                    <h4>Next Follow Up Information</h4>
                    <div class="input-col">
                        <label>Next Follow Up: </label>
                        <span>
                        <c:choose>
                        <c:when test="${appointment.nextFollowUp == true}">Yes</c:when>
                        <c:when test="${appointment.nextFollowUp == false}">No</c:when>
                        <c:otherwise>      </c:otherwise>
                        
                        </c:choose>
                        </span>
                        <label>Next Follow Up Type: </label>
                        <span>
                        <c:choose>
			                       	<c:when test="${appointment.followUpType=='none'}">
			                       		<td>  </td>
			                       	</c:when>
			                       	<c:otherwise>
										<td>${appointment.followUpType}</td>                       		
			                       	</c:otherwise>	
		                       	</c:choose>
                        </span>
                        
                    </div>
                    <div class="input-col">
                        <label>Next Follow Up Date: </label>
                        <c:choose>
                        	<c:when test="${appointment.followUpDate==null}">
                        		<span>  </span>
                        	</c:when>
                        	<c:otherwise>
                        	<c:set var="date" value="${appointment.followUpDate}"/>
								<c:set var="datesubstring" value="${fn:substring(date, 0, 10)}" />
		                        <c:set var="datesplit" value="${fn:split(datesubstring, '-')}" />
		                        <c:set var="day" value="${datesplit[2]}" />
								<c:set var="month" value="${datesplit[1]}" />
								<c:set var="year" value="${datesplit[0]}" />
		                        <span>${day}/${month}/${year}</span>               		
                        	</c:otherwise>
                        </c:choose>
                         <label>Next Follow Up Details: </label>
		                 <span>${appointment.followUpDetails}</span>        
                    </div>
                </div>
                <div class="btns">
                <a href="/sales/s/leads" class="form-btn">Back</a>
                </div>
                </form>
                </div>
            </div>
        </div>
        
    <%@include file="footer.jspf" %>
    </div>
    </div>

    </body>
</html>